<?php
defined('IN_XLP') or exit('Access Denied');
$Document = array(
    'pageid'   => 'seller-index', //页面标示
    'pagename' => '商户列表', //当前页面名称
    'mycss'    => array(), //加载的css样式表
    'myjs'     => array(), //加载的js脚本
    'footerjs' => array(),
    'head'     => true, //加载头部文件
);
include getTpl('header', 'public');
?>
<style>
tr th,tr td{text-align:center}
tr td img{border-radius:30px}
.txl{text-align:left}
.bank_info{text-align:left;line-height:20px;}
</style>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
<section id="content">
    <!-- main padder -->
    <section class="main padder">
        <div class="clearfix">
            <h4><i class="fa fa-table"></i>商户列表</h4>
            <section class="panel">
                <div class="panel-body">

                    <div class="table-responsive">
                        <table class="table table-striped b-t text-small">
                            <thead>
                                <tr>
                                    <th width="">序号</th>
                                    <th width="">商户UID</th>
                                    <th width="">姓名</th>
                                    <th width="">昵称</th>
                                    <th width="">头像</th>
                                    <th width="">入驻小区</th>
                                    <th width="">商户名称</th>
                                    <th width="">电话</th>
                                    <th width="200">地址</th>
                                    <th width="">注册时间</th>
                                    <th width="">收款信息</th>
                                    <th width="">特征码</th>
                                    <th width="">审核状态</th>
                                    <th width="">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if (empty($seller_list)): ?>
                                <tr>暂无数据</tr>
                                <?php else: ?>
                                <?php foreach ($seller_list as $k => $v): ?>
                                <tr>
                                    <td><?php echo $k+1 ?></td>
                                    <td><?php echo $v['uid'] ?></td>
                                    <td><?php echo $v['seller_name'] ?></td>
                                    <td><?php echo $v['nickname'] ?></td>
                                    <td><?php echo getAvatar($v['uid'],60,false,false,'user-pic f-l');?></td>
                                    <td><?php echo $v['village'] ?></td>
                                    <td><?php echo $v['seller_shop'] ?></td>
                                    <td><?php echo $v['seller_phone'] ?></td>
                                    <td class="txl"><?php echo $v['seller_addr'] ?></td>
                                    <td><?php echo $v['reg_time'] ?></td>
                                    <td>
                                        <div class="bank_info">
                                            <?php if ($v['bank_card_num']): ?>
                                            <div>卡&emsp;号：<?php echo $v['bank_card_num'] ?></div>
                                            <?php endif ?>
                                            <?php if ($v['bank_card_holder']): ?>
                                            <div>持卡人：<?php echo $v['bank_card_holder'] ?></div>
                                            <?php endif ?>
                                            <?php if ($v['bank_name']): ?>
                                            <div>开户行：<?php echo $v['bank_name'] ?></div>
                                            <?php endif ?>
                                            <?php if ($v['alipay']): ?>
                                            <div>支付宝：<?php echo $v['alipay'] ?></div>
                                            <?php endif ?>
                                            <?php if ($v['tenpay']): ?>
                                            <div>财付通：<?php echo $v['tenpay'] ?></div>
                                            <?php endif ?>
                                        </div>
                                    </td>
                                    <td><?php echo $v['seller_code'] ?></td>
                                    <td id="status_<?php echo $v['uid'] ?>"><?php echo $v['status'] ?></td>
                                    <td>
                                        <div class="btn-group">
                                            <button class="btn btn-white btn-xs dropdown-toggle" data-toggle="dropdown">操作<span class="caret"></span></button>
                                            <ul class="dropdown-menu">
                                                <li><a target="_blank" href="<?php echo U('seller/edit',array('uid'=>$v['uid'])) ?>">编辑</a></li>
                                                <?php if (!$v['passed']): ?>
                                                <li><a href="javascript:pass(<?php echo $v['uid'] ?>);">审核通过</a></li>
                                                <?php endif ?>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                <?php endforeach ?>
                                <?php endif ?>
                            </tbody>
                        </table>
                    </div>
                    
                    <footer class="panel-footer">
                        <div class="row">
                            <div class="col-sm-12 text-right text-center-sm">
                                <?php echo page($total,$page,'', 20, 'page');?>
                            </div>
                        </div>
                    </footer>

                </div>
            </section>
        </div>
    </section>
    <!--/ main padder -->
</section>
<!--/ content -->
<!--主体 结束-->
<script>
function pass(uid) {
    if(!confirm('确定此商家已通过审核吗？')) {
        return false;
    }
    $.post('<?php echo U("seller/pass") ?>',{"uid":uid},function(result){
        if(result.status==1) {
            $('#status_'+uid).text('已通过');
            Msg.ok('已通过');
        } else {
            Msg.error(result.info);
        }
    }, 'JSON');
}
</script>
<?php include getTpl('footer', 'public'); ?>